package com.crm.dataReceive.controller;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.crm.custinfo.domain.CustInfo;
import com.crm.custinfo.domain.HitPackage;
import com.crm.custinfo.service.ICustInfoService;
import com.crm.custinfo.service.IHitPackageService;
import com.crm.dataReceive.domain.CheckApi;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.AesUtils;
import com.ruoyi.common.utils.Md5Encrypt;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/commonProcessing")
public class CommonProcessingController extends BaseController {
    public static final org.slf4j.Logger logger = LoggerFactory.getLogger("CustPrefix8CheckInfo");
    @Autowired
    private ICustInfoService custInfoService;
    @Anonymous
    @PostMapping("/encryptMobileBatch/tenant/{tenantId}")
    public Map<String, Object> encryptMobileBatch() {
        Map<String, Object> map = new HashMap<>();
        List<CustInfo> list = custInfoService.selectCustInfoList(new CustInfo());
        for (CustInfo custInfo : list) {
            if(custInfo.getEncval() != null&& custInfo.getEncval().length() > 0) {
                continue;
            }
            custInfoService.encryptMobile(custInfo, logger);
        }
        map.put("code", 200);
        map.put("msg", "成功");
        map.put("data",new String[]{});
        return map;
    }

}
